#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "InteractionFragment.h"
#include "NamedElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Constraint;
class Lifeline;

/// <summary>
/// StateInvariant
/// A StateInvariant is a runtime constraint on the participants of the Interaction.
/// It may be used to specify a variety of different kinds of Constraints, such as
/// values of Attributes or Variables, internal or external States, and so on. A
/// StateInvariant is an InteractionFragment and it is placed on a Lifeline.
/// </summary>
class UMLMODEL_EXPORT StateInvariant : public NamedElement, public InteractionFragment {

public: // Constructors and destructors
    explicit StateInvariant(const QString& umlType="uml::StateInvariant");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// covered getter
    /// References the Lifeline on which the StateInvariant appears.
    /// </summary>
    shared_ptr<Lifeline> covered() const;

    /// <summary>
    /// covered setter
    /// References the Lifeline on which the StateInvariant appears.
    /// </summary>
    void setCovered(shared_ptr<Lifeline> value);

    /// <summary>
    /// invariant getter
    /// A Constraint that should hold at runtime for this StateInvariant.
    /// </summary>
    shared_ptr<Constraint> invariant() const;

    /// <summary>
    /// invariant setter
    /// A Constraint that should hold at runtime for this StateInvariant.
    /// </summary>
    void setInvariant(shared_ptr<Constraint> value);

private: // Fields
    /// <summary>
    /// covered
    /// References the Lifeline on which the StateInvariant appears.
    /// </summary>
    shared_ptr<Lifeline> covered_;

    /// <summary>
    /// invariant
    /// A Constraint that should hold at runtime for this StateInvariant.
    /// </summary>
    shared_ptr<Constraint> invariant_;

};

} // namespace uml
